package com.jiangjiang.eshop.commodity.state;

import com.jiangjiang.eshop.commodity.constant.GoodsStatus;
import com.jiangjiang.eshop.commodity.dto.GoodsDTO;
import com.jiangjiang.eshop.commodity.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName PuttedOnShelvesGoodsState
 * @Description TODO
 * @Author jhw
 * @Date 2021/8/17 10:17
 * @Version 1.0
 **/
@Component
public class PuttedOnShelvesGoodsState implements GoodsState {
    @Autowired
    private GoodsService goodsService;
    @Override
    public void doTransition(GoodsDTO goodsDTO) {
        goodsService.updateGoodsStatus(goodsDTO.getId(), GoodsStatus.PUTTED_ON_SHELVES);
    }

    @Override
    public Boolean canEdit(GoodsDTO goodsDTO) {
        return false;
    }

    @Override
    public Boolean canApprove(GoodsDTO goodsDTO) {
        return false;
    }

    @Override
    public Boolean canPutOnShelves(GoodsDTO goodsDTO) {
        return false;
    }

    @Override
    public Boolean canPullOffShelves(GoodsDTO goodsDTO) {
        return true;
    }

    @Override
    public Boolean canRemove(GoodsDTO goodsDTO) {
        return false;
    }
}
